package com.price.common.viewbinding.base

import android.view.View
import com.price.common.recyclerview.BaseViewHolder
import androidx.viewbinding.ViewBinding
import com.price.core.R

@Suppress("UNCHECKED_CAST")
fun <VB : ViewBinding> BaseViewHolder.getBinding(bind: (View) -> VB): VB =
    itemView.getTag(R.id.tag_view_binding) as? VB ?: bind(itemView).also { itemView.setTag(R.id.tag_view_binding, it) }